
<table class="table table-bordered table-hover" id="user-list">
    @if($u_count == 2)
      <thead>
          <tr>
              <th>回合</th>
              <th>东</th>
              <th>南</th>
          </tr>
      </thead>   
    @elseif($u_count == 3)
      <thead>
          <tr>
              <th>回合</th>
              <th>东</th>
              <th>南</th>
              <th>西</th>
          </tr>
      </thead>   
    @elseif($u_count == 4) 
      <thead>
          <tr>
              <th>回合</th>
              <th>东</th>
              <th>南</th>
              <th>西</th>
              <th>北</th>
          </tr>
      </thead>   
    @endif 
    <tbody> 
        @foreach($games as $key => $game)
            <?php 
              $seats = json_decode($game->history, true);
              $seats = $seats['seats'];
            ?>
            <tr>
                <td>{{$key + 1}}</td>
                @foreach($users as $jay => $user)
                  <td>
                    <img src="{{$user['avatar']}}" style="width:15px"> {{$user['name']}} @if(array_key_exists($jay, $seats)) ({{$seats[$jay]['score']}}) @endif
                  </td>
                @endforeach
            </tr>
        @endforeach
    </tbody>


</table>

<script type="text/javascript">
    $(function () {
        $('#user-list').DataTable({
          "paging": false,
          "lengthChange": false,
          "searching": false,
          "info": false,
          "autoWidth": true,
          "columns": [
            {"orderable": false},
            {"orderable": false}
          ]
        });
    });
</script>    
